package com.example.emos.wx.controller;


import com.example.emos.wx.common.util.R;
import com.example.emos.wx.controller.form.UserFormTest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/test")
@Api("测试Web接口")
public class TestController {
    @GetMapping("/sayHello")
    @ApiOperation("最简单的测试方法")
    public R sayHello() {
        return R.ok().put("resultData", "HelloWorld!");
    }

    @PostMapping("/testValidUser")
    @ApiOperation("测试验证库方法")
    public R userInfoTest(@Valid @RequestBody UserFormTest form) {
        return R.ok().put("resultData", "Hello,"+form.getName()+form.getAge()+"了！");
    }


}
